//从插件内导出createRouter、createWebHashHistory
import { createRouter,createWebHashHistory } from "vue-router";

import ZhuCe from "@/components/ZhuCe.vue";
import TouPiao from "@/components/TouPiao.vue";
    import MoRen from "@/components/zi/MoRen.vue";
    import ZuiXin from "@/components/zi/ZuiXin.vue"


//定义路由表
const routes=[
    {
        path:'/',
        redirect:'/zhuce',
    },
    {
        path:'/zhuce',
        name:'ZhuCe',
        component:ZhuCe
    },
    {
        path:'/toupiao',
        name:'TouPiao',
        component:TouPiao,
        children:[            
            {
                path:'zuixin',
                name:'ZuiXin',
                component:ZuiXin
            },
            {
                path:'moren',
                name:'MoRen',
                component:MoRen
            },

        ]
    }
];

//定义路由器/创建路由器
const router=createRouter({
    //调用路由表，实现router-link的跳转以及router-view的渲染
    // routes:routes,
    routes,

    //将路由的历史模式设置为hash模式（哈希历史）
    history:createWebHashHistory(),
});

//导出路由器
export default router;